<template>
  <div class="article-content" id="article-content">
    <el-form
      class="base-ariticle"
      @submit.native.prevent
      :model="productDetail"
      ref="contentForm"
      :rules="rules"
    >
      <div class="content-item">
        <el-row>
          <el-col :span="24">
            <div class="content-title">基本信息</div>
          </el-col>
        </el-row>
        <el-form-item label="产品标题" prop="productName">
          <el-input
            class="contentDetail-title"
            placeholder="请输入产品标题（必填）"
            v-model.trim="productDetail.productName"
            maxlength="100"
            show-word-limit
          ></el-input>
        </el-form-item>
        <el-form-item label="产品Code" prop="productCode">
          <el-input
            class="contentDetail-title"
            placeholder="请输入产品Code"
            v-model.trim="productDetail.productCode"
            maxlength="100"
            show-word-limit
          ></el-input>
        </el-form-item>
        <el-form-item label="产品简介" prop="summary">
          <el-input
            class="contentDetail-title"
            placeholder="请输入产品简介"
            v-model.trim="productDetail.summary"
            maxlength="100"
            show-word-limit
          ></el-input>
        </el-form-item>
        <el-form-item label="产品价格" prop="price">
          <el-input
            onkeyup="this.value=this.value.replace(/\D/g,'')"
            onafterpaste="this.value=this.value.replace(/\D/g,'')"
            class="contentDetail-title"
            placeholder="请输入产品价格"
            v-model="productDetail.price"
            maxlength="100"
          ></el-input>
        </el-form-item>
        <el-form-item label="产品区域" prop="regionId">
          <el-input
            class="contentDetail-title"
            placeholder="请输入产品区域"
            v-model="productDetail.regionId"
            maxlength="100"
          ></el-input>
        </el-form-item>

        <el-form-item label="详情描述" prop="description" class="desc-textarea">
          <el-input
            type="textarea"
            :autosize="{ minRows: 3, maxRows: 3 }"
            placeholder="请输入产品详情描述"
            v-model="productDetail.description"
            maxlength="500"
            show-word-limit
          ></el-input>
        </el-form-item>
      </div>

      <div class="content-item seo-key"></div>
    </el-form>
  </div>
</template>
<script>
export default {
  props: ["productDetail"],
  components: {},
  provide: {},
  data() {
    return {
      // productDetail: {},
      rules: {
        productName: [
          {
            required: true,
            message: "请输入产品标题",
            trigger: "blur",
          },
        ],
        productCode: [
          {
            required: true,
            message: "请输入产品Code",
            trigger: "blur",
          },
        ],
        price: [
          {
            required: true,
            message: "请输入产品价格",
            trigger: "blur",
          },
        ],
        regionId: [
          {
            required: true,
            message: "请输入产品区域",
            trigger: "blur",
          },
        ],
      },
    };
  },
  created() {
    // this.getTree();
  },
  mounted() {
    this.detailId = this.$route.query.id;
  },
  methods: {
    textIndent(ele, width) {
      this.$nextTick(() => {
        ele.style.textIndent = width + "px";
      });
    },
  },

  watch: {},
};
</script>

<style scoped lang="scss">
// @import "../../style/contentDetail";
.address /deep/ .el-input__inner {
  height: 35px;
  line-height: 35px;
}
.category {
  position: relative;
  vertical-align: middle;
}
.product-category {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px;
  min-height: 20px;
  width: 250px;
  border: $--border-base;
  transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
  .category-list {
    .category-item {
      display: inline-block;
      border: $--border-base;
      color: #fff;
      border-radius: 30px;
      padding: 5px 10px;
      margin-bottom: 5px;
      font-size: $--font-size-small;
      margin-right: 5px;
      background: $--color-primary;
      .el-icon-close {
        cursor: pointer;
        color: #fff;
      }
    }
  }
  .el-select__caret {
    color: #c0c4cc;
    font-size: $--font-size-small;
    cursor: pointer;
  }
}

.multipleCatagory {
  height: 0;
  margin-top: 12px;
  margin-left: 40px;
  width: 238px;
  position: absolute;
  background: #fff;
  z-index: 10;
  box-sizing: border-box;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.modal-footer {
  height: 60px;
  position: absolute;
  bottom: -11px;
  right: 16px;
  width: 100%;
  z-index: 100;
  text-align: right;
  padding-top: 0;
}
</style>

<style lang="scss">
.el-textarea /deep/ .el-input__count {
  background: #fff;
  bottom: 1px;
  right: 16px;
}
.desc-textarea /deep/ .el-form-item__content .el-textarea .el-textarea__inner {
  padding-bottom: 50px;
}
.article-content /deep/ .el-collapse-item__content {
  font-size: $--font-size-base;
}
.article-content /deep/ .el-collapse-item__header {
  font-size: $--font-size-base;
  font-weight: 600;
}
.article-content /deep/ .el-form-item__label {
  font-size: $--font-size-small;
}
.set-article /deep/ .el-select {
  width: 220px;
}
.flexSpace {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
</style>
